<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>New Web Project</title>
		
	 	<!-- Needed by the test runner UI -->
		<link type="text/css" rel="stylesheet" href="test/lib/fonts-min.css" /> 
		<script type="text/javascript" src="test/lib/yui-min.js"></script>

	 	<!-- Unit Test Framework Library -->
		<script type="text/javascript" src="test/lib/yuitest_1.0.0b1.js"></script>
		
	 	<!-- Objs library -->
		<script type="text/javascript" src="src/Objs.js"></script>
		<!--script type="text/javascript" src="bin/objs-2.0-min.js"></script-->

	 	<!-- Objs Unit Test Cases -->
		<script type="text/javascript" src="test/src/ObjsTest.js"></script>

		<style type="text/css">
		.yui3-skin-sam
		.yui3-console-entry-pass
		.yui3-console-entry-cat
		{
		    background-color: green;
		    color: #fff;
		}
		 
		.yui3-skin-sam
		.yui3-console-entry-fail
		.yui3-console-entry-cat
		{
		    background-color: red;
		    color: #fff;
		}
		 
		.yui3-skin-sam
		.yui3-console-entry-ignore
		.yui3-console-entry-cat
		{
		    background-color: #666;
		}
		 
		</style>

    </head>
	<body class="yui3-skin-sam  yui-skin-sam"> 
		 
		<h1>Objs Test Suite</h1> 
		 
		<div id="testLogger"></div>
		
		<script type="text/javascript">
			
			var src ="src/Objs.js"
			
			function tearDownTests(){}
		
		</script>
		
		<script type="text/javascript">
			YUI().use
			(
				"console",
				function(Y)
				{
				    //create the console
				    var r = new Y.Console
					(
						{
					        newestOnTop : false,
					        style: 'block' // to anchor in the example content
					    }
					);    
				    
				    r.render('#testLogger');
				    
				    var TestRunner = YUITest.TestRunner;
					TestRunner.setName("Objs Test Runner");
				    TestRunner.add(ObjsTest);
	
				    //function to handle events generated by the testrunner
				    function logEvent(event)
					{
				        //data variables
				        var message = "";
				        var messageType = "";
				        
				        switch(event.type)
						{
				            case TestRunner.BEGIN_EVENT:
				                message = "Testing began at " + (new Date()).toString() + ".";
				                messageType = "info";
				            break;
				                
				            case TestRunner.COMPLETE_EVENT:
				                message = Y.substitute
								(
									"Testing completed at " +
				                    (new Date()).toString() + ".\n" +
				                    "Passed:{passed} Failed:{failed} " +
				                    "Total:{total} ({ignored} ignored)",
				                    event.results
								);
				                messageType = "info";
				            break;
				                
							case TestRunner.TEST_FAIL_EVENT:
				                message = event.testName + ": failed.\n" + event.error.getMessage();
				                messageType = "fail";
							break;
				                
				            case TestRunner.TEST_IGNORE_EVENT:
				                message = event.testName + ": ignored.";
				                messageType = "ignore";
							break;
				                
				            case TestRunner.TEST_PASS_EVENT:
				                message = event.testName + ": passed.";
				                messageType = "pass";
							break;
				                
				            case TestRunner.TEST_SUITE_BEGIN_EVENT:
				                message = "Test suite \"" + event.testSuite.name + "\" started.";
				                messageType = "info";
							break;
				                
				            case TestRunner.TEST_SUITE_COMPLETE_EVENT:
				                message = Y.substitute
								(
									"Test suite \"" +
				                    event.testSuite.name + "\" completed" + ".\n" +
				                    "Passed:{passed} Failed:{failed} " +
				                    "Total:{total} ({ignored} ignored)",
				                    event.results
								);
				                messageType = "info";
							break;
				                
				            case TestRunner.TEST_CASE_BEGIN_EVENT:
				                message = "Test case \"" + event.testCase.name + "\" started.";
				                messageType = "info";
							break;
				                
				            case TestRunner.TEST_CASE_COMPLETE_EVENT:
				                message = Y.substitute
								(
									"Test case \"" +
				                    event.testCase.name + "\" completed.\n" +
				                    "Passed:{passed} Failed:{failed} " +
				                    "Total:{total} ({ignored} ignored)",
				                    event.results
								);
				                messageType = "info";
							break;
			
				            default:
				                message = "Unexpected event " + event.type;
				                message = "info";
				        }
				    
				        //only log if required
				        Y.log(message, messageType, "TestRunner");
				    }
				    
				    //listen for events to publish to the logger
				    TestRunner.attach(TestRunner.BEGIN_EVENT, logEvent);
				    TestRunner.attach(TestRunner.COMPLETE_EVENT, logEvent);
				    TestRunner.attach(TestRunner.TEST_CASE_BEGIN_EVENT, logEvent);
				    TestRunner.attach(TestRunner.TEST_CASE_COMPLETE_EVENT, logEvent);
				    TestRunner.attach(TestRunner.TEST_SUITE_BEGIN_EVENT, logEvent);
				    TestRunner.attach(TestRunner.TEST_SUITE_COMPLETE_EVENT, logEvent);
				    TestRunner.attach(TestRunner.TEST_PASS_EVENT, logEvent);
				    TestRunner.attach(TestRunner.TEST_FAIL_EVENT, logEvent);
				    TestRunner.attach(TestRunner.TEST_IGNORE_EVENT, logEvent);
				    
				 
				    //run the tests
				    TestRunner.run();
				}
			);
		</script> 
    </body>
</html>